package com.bjsxt.ego.goods.pojo;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.bjsxt.ego.users.pojo.Admins;

/**
 * 商品分类的pojo
 * 
 * @author 章鸿敏
 *
 */
public class GoodsCategory
{
	private int id;
	private int adminsId;
	private int parentId;
	private String name;
	private String url;
	private String spec;
	private String content;
	private byte status;
	private Date createTime;
	private Date updateTime;
	private Date pubTime;

	/*关联关系*/
	private Admins admins;
	/*关联自己*/
	private GoodsCategory parentCategory;
	/*根节点下面所有子节点的集合*/
	private List<GoodsCategory> childCategoryList = new ArrayList<GoodsCategory>();
	
	/*字符串描述*/
	private String statusStr;
	/**
	 * 格式例如:
	 * |-->家电
	 * |-->|-->电视
	 * |-->|-->|-->国产品牌
	 */
	private String treeName;
	
	public int getId()
	{
		return id;
	}

	public void setId(int id)
	{
		this.id = id;
	}

	public int getAdminsId()
	{
		return adminsId;
	}

	public void setAdminsId(int adminsId)
	{
		this.adminsId = adminsId;
	}

	public int getParentId()
	{
		return parentId;
	}

	public void setParentId(int parentId)
	{
		this.parentId = parentId;
	}

	public String getName()
	{
		return name;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public String getUrl()
	{
		return url;
	}

	public void setUrl(String url)
	{
		this.url = url;
	}

	public String getSpec()
	{
		return spec;
	}

	public void setSpec(String spec)
	{
		this.spec = spec;
	}

	public String getContent()
	{
		return content;
	}

	public void setContent(String content)
	{
		this.content = content;
	}

	public byte getStatus()
	{
		return status;
	}

	public void setStatus(byte status)
	{
		this.status = status;
	}

	public Date getCreateTime()
	{
		return createTime;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public Date getUpdateTime()
	{
		return updateTime;
	}

	public void setUpdateTime(Date updateTime)
	{
		this.updateTime = updateTime;
	}

	public Date getPubTime()
	{
		return pubTime;
	}

	public void setPubTime(Date pubTime)
	{
		this.pubTime = pubTime;
	}

	public Admins getAdmins()
	{
		return admins;
	}

	public void setAdmins(Admins admins)
	{
		this.admins = admins;
	}

	public String getStatusStr()
	{
		/**
		 *  状态:0:禁用；1:启用
		 */
		GoodsCategoryEnum[] goodsCategoryEnums = GoodsCategoryEnum.values();
		for (int i = 0; i < goodsCategoryEnums.length; i++)
		{
			GoodsCategoryEnum goodsCategoryEnum = goodsCategoryEnums[i];
			if (goodsCategoryEnum.toString().startsWith("STATUS_"))
			{
				/*如果循环的枚举==数据库存储的状态值,赋值枚举指定的字符串*/
				if (goodsCategoryEnum.getStatus()==this.status)
				{
					this.statusStr = goodsCategoryEnum.getInfo();
					break;
				}
			}
		}
		return statusStr;
	}

	public GoodsCategory getParentCategory()
	{
		return parentCategory;
	}

	public void setParentCategory(GoodsCategory parentCategory)
	{
		this.parentCategory = parentCategory;
	}

	public List<GoodsCategory> getChildCategoryList()
	{
		return childCategoryList;
	}

	public void setChildCategoryList(List<GoodsCategory> childCategoryList)
	{
		this.childCategoryList = childCategoryList;
	}

	public String getTreeName()
	{
		return treeName;
	}

	public void setTreeName(String treeName)
	{
		this.treeName = treeName;
	}


}